<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <!-- 127.0.0.1:8090/css/main.css -->
    <!-- <link rel="stylesheet" href="./css/main.css" /> -->
    <!-- <link rel="stylesheet" href="http://www.baidu.com/css/main.css" /> -->
  </head>
  <body>
    <h1>HELLO Index</h1>
    <script src="./axios.min.js"></script>
    <script>
      const request = axios.create({
        baseURL: "http://127.0.0.1:8090/api/collections",
        params: { a: 1, b: 2 },
        headers: { username: "jack", age: 20 },
      });

      // GET /todolist/records?page=1&perPage=10&filter=(title='吃饭') HTTP/1.1
      // GET /api/collections/todolist/records?a=100&b=2&page=1&perPage=2 HTTP/1.1

      request
        .get("/todolist/records", {
          params: { page: 1, perPage: 2, a: 100 },
          headers: {
            username: "lili",
          },
        })
        .then((data) => {
          console.log(data);
        });

      /* 
      POST /api/collections/todolist/records HTTP/1.1
      Content-Type: application/json
      
      {"title":"游戏","status":1} 
      */
      /* request
        .post("http://127.0.0.1:8090/api/collections/todolist/records", {
          title: "游戏",
          status: 1,
        })
        .then((res) => console.log(res)); */

      //---
      /* request
        .patch("http://127.0.0.1:8090/api/collections/todolist/records/81zexuqml293ed7", {
          title: "游戏跑步",
          status: 3,
        })
        .then((res) => console.log(res)); */
      // axios.delete(url[, config])
      /*  request
        .delete(
          "http://127.0.0.1:8090/api/collections/todolist/records/81zexuqml293ed7"
        )
        .then((res) => console.log(res)); */
    </script>
  </body>
</html>
